package com.hmall.user.inteceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配置类，我们要让自定义的拦截器让springmvc认可
 */
@Configuration
public class MyWebMvcConfig implements WebMvcConfigurer {
    /**
     * 让自定义的拦截器加入到springmvc的拦截器集合中
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //把自定义的拦截器加入到了默认拦截器集合中
        registry.addInterceptor(new MyHandleInteceptor()).addPathPatterns("/**");
    }
}
